package com.avic.rong.course.activity;

import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.avic.rong.BaseActivity;
import com.avic.rong.R;
import com.avic.rong.course.adapter.CompanysRvAdapter;
import com.avic.rong.course.adapter.PublishAdapter;
import com.avic.rong.course.bean.CompanysBean;
import com.avic.rong.course.showapi.CompanysApi;
import com.avic.rong.course.showapi.ToggleFollowApi;
import com.avic.rong.utils.ConstantsUtils;
import com.avic.rong.utils.DensityUtils;
import com.avic.rong.utils.SharedPreferencesUtil;
import com.avic.rong.utils.ToastTools;
import com.avic.rong.wedgit.loadingLayout.LoadingLayout;
import com.example.minato.minastore.BaseResultEntity;
import com.example.minato.minastore.http.HttpManager;
import com.example.minato.minastore.listener.HttpOnNextListener;
import com.orhanobut.logger.Logger;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PublishActivity extends BaseActivity {

    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.iv_right)
    ImageView ivRight;
    @BindView(R.id.ll_root)
    LinearLayout llRoot;
    @BindView(R.id.publish_rv)
    RecyclerView publish_rv;
//    @BindView(R.id.loading_layout)
//    LoadingLayout loading_layout;

    //    @BindView(R.id.refreshLayout)
//    SmartRefreshLayout refreshLayout;
    private PublishAdapter publishAdapter;


//    private CompanysApi companysApi;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_publish;
    }

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        ivRight.setImageResource(R.mipmap.gouwuche_dot);

        publish_rv.setLayoutManager(new LinearLayoutManager(this));
        publishAdapter = new PublishAdapter(this);
        publish_rv.setAdapter(publishAdapter);

        if ("发布需求".equals(getIntent().getStringExtra("type"))) {
            tvTitle.setText("发布需求");
            initData();
        } else {
            tvTitle.setText("发布供应");
            initData1();
        }

    }

    // todo
    private void initData() {
//        【发布需求】
        String[] title = {"1.访问融融网www.rongrong.cn", "2.登录融融网账号进入买家中心", "3.在买家中心发布需求", "4.审核通过"};
        String[] company = {"请在电脑端浏览器中输入该网址", "登录账号进入买家中心", "填写需求信息、需求描述和联系方式，提交审核", "预计2个工作日内完成审核，审核通过后需求发布成功"};
        int[] icon = {R.mipmap.delete, R.mipmap.activity_compare_active, R.mipmap.delete, R.mipmap.activity_compare_active};
        publishAdapter.setDataList(title, company, icon);
    }

    private void initData1() {
//        【发布供应】
        String[] title = {"1.访问融融网www.rongrong.cn", "2.登录融融网账号进入卖家中心", "3.在卖家中心发布供应", "4.审核通过"};
        String[] company = {"请在电脑端浏览器中输入该网址", "需要申请成为融融卖家方可发布供应", "填写供应信息、供应描述和联系方式，提交审核", "预计2个工作日内完成审核，审核通过后供应发布成功"};
        int[] icon = {R.mipmap.delete, R.mipmap.activity_compare_active, R.mipmap.delete, R.mipmap.activity_compare_active};
        publishAdapter.setDataList(title, company, icon);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }


    @Override
    protected void addListener() {

    }
}
